Skip to content

fix(quota): use complete C1 for ordinary should-run calls - #9139

Closed
loopx-agent wants to merge 5 commits into
mainfrom
codex/c1-ordinary-default-cutover-20261120
Closed

loopx-agent wants to merge 5 commits into
mainfrom
codex/c1-ordinary-default-cutover-20261120

Conversation

@loopx-agent

Copy link
Copy Markdown
Collaborator

Summary

  • Use the complete C1 contract for ordinary should-run calls (loopx/cli_commands/quota_registration.py, quota_presentation.py, cli_output_budget.py) and update the bilingual unified contract RFCs and testing docs.
  • Migrate remaining C1 consumer assertions and calibrate the complete Vision presentation baseline and differential probes across tests/cli_commands/test_quota_turn_envelope_validation_failure.py, tests/control_plane/test_cli_output_budget.py, tests/control_plane/test_cli_output_probe_runner.py, tests/control_plane/test_context_delivery_cli.py, and tests/test_runtime_snapshot_publication.py.

Local Verification

  • uv run --extra test python -m pytest tests/cli_commands/test_quota_turn_envelope_validation_failure.py tests/control_plane/test_cli_output_budget.py tests/control_plane/test_cli_output_probe_runner.py tests/control_plane/test_context_delivery_cli.py tests/test_runtime_snapshot_publication.py — 192 passed, 1 skipped
  • uv run python scripts/check_rfc_bilingual.py --base origin/main --head HEAD — passed
  • uv run loopx --runtime-root /Users/huangruiteng/.loopx check --scan-path ... — passed (0 errors, public boundary scan clean across 12 files)

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · Gemini · Google DeepMind · self_reported

Request changes conclusion (author-owned PR; GitHub blocks formal self-review)

对精确提交 6d05582045d064b83a6addcec2bb01c747f2d50f 的独立只读复核结论为 REQUEST_CHANGES。PR #9139 虽然让关联配额与预算契约单测(5 个文件 192 passed, 1 skipped)自洽通过,但它在尚未完成 C1 单会话收益/全成本分布认证、也未同步切换 PUBLIC_DEFAULT_CONTRACT 契约的前提下移除了 #9084 为未声明 JSON 调用保留的兼容路径,导致 scripts/qualify_runtime_artifact.py、scripts/runtime_artifact.py 与 scripts/desktop_runtime_bundle.py 中的 validate_default_contract 门禁直接失败,阻断主干运行时快照与版本安装包发布。

动机 / Motivation

未声明宿主参数的 loopx --format json quota should-run 普通调用方,以及依赖 validate_default_contract 的运行时快照、桌面端安装包和发行产物构建维护者。改动前(#9084 合入后主干),普通未声明宿主的 quota should-run 返回已通过分布合同的 quota_packet,runtime-snapshots.yml、scripts/qualify_runtime_artifact.py 与 scripts/desktop_runtime_bundle.py 均可通过校验;改动后,compose_quota_work_contract 与 _project_quota_cli_payload 移除 #9084 兼容分支,无参数普通调用默认输出 loopx_turn_envelope_v1,而 tests/test_runtime_snapshot_publication.py 则改为断言 validate_default_contract 拒绝当前主干默认输出。在当前精确提交上进行反向运行时探针实测,observe_default_contract(Path('.')) 返回 complete_turn / loopx_turn_envelope_v1,随后 validate_default_contract(observed) 立即抛出 ValueError: Runtime default contract is unqualified for public adoption,直接阻塞所有安装包与快照发布门禁。同时本 PR 的明确边界是:不包含对 C1 单会话收益与全成本基线测试本身的重新设计,也不在本 PR 中放宽 PUBLIC_DEFAULT_CONTRACT 安全门槛。

如果现在按现状合入本 PR,哪怕 PR 自带的单测全绿,主干上的 runtime-snapshots.yml、desktop-release-artifacts.yml 与 release-artifacts.yml 也会立刻在 validate_default_contract 报错停摆(因为作者在 tests/test_runtime_snapshot_publication.py 中反过来断言发布探针抛出 "unqualified for public adoption",等于确认主干默认输出尚未获准发布)。参考仓库契约与 RFC(docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md 与 loopx/cli_commands/update_artifact.py:validate_default_contract),complete_turn 在取得单会话结果/全成本及受支持 profile 资格认证前,不应破坏已发布默认契约。

改动思路 / Approach

针对“普通 CLI 是否全面切换到 loopx_turn_envelope_v1”的问题,试图在 loopx/cli_commands/quota_presentation.py 收敛普通 quota should-run 至单一 compose_turn_decision(loopx_turn_envelope_v1),同时保留 examples/control_plane/cli-output-probe-runner.py 的仅基线测量辅助函数 _historical_ordinary_quota_carrier;但由于上游分布门禁 loopx/cli_commands/update_artifact.py:validate_default_contract 仍锁定旧 PUBLIC_DEFAULT_CONTRACT,该收口直接在下游发布链条上造成契约断裂。本次复核边界为:改动涉及 12 个文件(+225/-142),跨 quota_presentation.py、quota_registration.py、cli_output_budget.py、RFC/质量文档及 6 份测试/探针,未同步满足 scripts/qualify_runtime_artifact.py / desktop_runtime_bundle.py 的分布契约前提。

  1. 移除兼容返回路径:compose_quota_work_contract 删除了 #9084 为 undeclared JSON caller 返回旧 quota_packet 的分支,_project_quota_cli_payload 删除了 compact_quota_should_run_cli_payload 与 project_captured_replan_cli_view,导致普通无参数 JSON 调用输出 loopx_turn_envelope_v1。quota_registration.py 将 --turn-envelope 与 --complete-turn 改回兼容别名说明。
  2. 预算上限与探针调整:cli_output_budget.py 将 Vision 合成夹具 JSON 预算从 59000 上调至 61100(实测 60,826 字符,留 274 字符余量),examples/control_plane/cli-output-probe-runner.py 仅对 enforce_budget=False 基线对比提供 _historical_ordinary_quota_carrier。
  3. 与分布契约冲突:scripts/qualify_runtime_artifact.py:114、scripts/runtime_artifact.py:61 与 scripts/desktop_runtime_bundle.py:120 在构建与验证发布产物时均强依赖 validate_default_contract(observe_default_contract(...)),该门禁要求默认 CLI 符合 public_default_contract.json。相比保留 #9084 兼容分支直至 C1 完成资格认证后再统一切换,直接切断兼容性会让主干长期处于“不可打包发布”的半成品状态。

具体改动 / Changes

  • 核心与 CLI(3 文件):loopx/cli_commands/quota_presentation.py(-23)、loopx/cli_commands/quota_registration.py(+2/-2)、loopx/control_plane/testing/cli_output_budget.py(+5/-4)。
  • 文档与规范(3 文件):docs/architecture/rfcs/controller-executor-unified-contract-v0/contract-and-context.md(+9)、contract-and-context.zh-CN.md(+6)、docs/development/testing-and-quality.md(+31,记录 60,826 baseline 与 61,100 allowance)。
  • 示例探针与测试(6 文件):examples/control_plane/cli-output-probe-runner.py(+32)、tests/cli_commands/test_quota_turn_envelope_validation_failure.py、tests/control_plane/test_cli_output_budget.py、tests/control_plane/test_cli_output_probe_runner.py、tests/control_plane/test_context_delivery_cli.py、tests/test_runtime_snapshot_publication.py。

对主干的风险 / Risks

阻塞问题(Required Fixes)

  1. [P1 · 阻断主干快照、Release 与 Desktop 打包资格门禁]:在本 PR 精确头上执行独立反事实探针 scripts.qualify_runtime_artifact.observe_default_contract(Path(".")),实测返回 {"surface": "complete_turn", "schema_version": "loopx_turn_envelope_v1", "interaction_schema_version": "loopx_interaction_contract_v0"};传入 loopx.cli_commands.update_artifact.validate_default_contract 直接抛出 ValueError("Runtime default contract is unqualified for public adoption; ...")。tests/test_runtime_snapshot_publication.py:384 把该失败改写成了预期断言,导致合入后 runtime-snapshots.yml、release-artifacts.yml 与 scripts/desktop_runtime_bundle.py 无法产出通过资格核验的安装包。修复方向:请先完成 C1 发布资格并在同一 PR 升级 PUBLIC_DEFAULT_CONTRACT,或保留 #9084 为未声明 JSON/发布探针提供的兼容分发路由,不可让 main 默认契约退回不可发布状态。
  2. [P2 · 关联上下文交付测试未完成迁移且分支落后 origin/main]:独立运行 pytest tests/control_plane/test_turn_host_context_delivery.py 在 eb552a8bb0 与 6d05582045d064b83a6addcec2bb01c747f2d50f 上均出现 8 failed(assert 'loopx_turn_envelope_v1' == 'loopx_turn_envelope_v0'),test_replan_staged_read.py 等也存在未收口断言;此外 PR 分支当前相对最新 origin/main 处于 BEHIND,合入前需 rebase 并全量回归相关配额与宿主上下文套件。

本地验证实录

  • PR 声明的 5 份 pytest 文件(test_quota_turn_envelope_validation_failure.py、test_cli_output_budget.py、test_cli_output_probe_runner.py、test_context_delivery_cli.py、test_runtime_snapshot_publication.py):192 passed, 1 skipped。
  • tests/control_plane/test_turn_host_context_delivery.py(基线 eb552a8bb0 与精确头 6d05582045d064b83a6addcec2bb01c747f2d50f 对比):8 failed / 8 failed(v1 != v0 既存在混合过渡未完成)。
  • 运行时分发契约反向探针(observe_default_contract + validate_default_contract):触发 P1 ValueError 拒绝。
  • ruff check(涉及文件)、check_rfc_bilingual.py、cli-help-manpage-smoke.py、loopx check(5207 files, 0 errors)、canary premerge --tier quick(对比 eb552a8bb0 与最新 origin/main):通过。

我的整体评价 / Verdict

  • Long-horizon 与 User experience 影响:long_horizon 评估为 regressed——在分布合同尚未切替之前将无标记默认 quota should-run 改为被 validate_default_contract 拒绝的 complete_turn,会切断主干 runtime-snapshots 与桌面/Release 构建;user_experience 同样为 regressed,最终用户与安装器无法拿到合法签名校验的 loopx 运行时与安装包。前端可视化评审判定:PR #9139 仅修改 CLI/控制面配额默认输出策略、RFC 文档与测试探针,不涉及任何 Web 前端或桌面界面视图渲染。 未验证范围:none。
  • 架构与工作量判定:当前变更边界未通过下游发布契约(scope_fit: blocked_by_downstream_contract / authority_semantics: misleading 表现为源码未达发布门槛即默认替换公共返回面),需要解决上述 P1 门禁冲突并更新后重审。

English verdict: REQUEST_CHANGES

@mergify

mergify Bot commented Nov 20, 2026

Copy link
Copy Markdown

This pull request has merge conflicts with main and cannot be merged
until they are resolved. Please rebase or merge the base branch, @loopx-agent.

Choose the remote for the base repository, not an out-of-date fork.
For a fork clone, first inspect git remote -v; upstream must point
to https://github.com/loopx-project/loopx.git. If it is absent, add it
with git remote add upstream https://github.com/loopx-project/loopx.git.
Then run:

git fetch upstream
git rebase upstream/main
# Resolve each conflict, git add the resolved files, then git rebase --continue.
git push --force-with-lease origin HEAD

For a same-repository clone whose origin points to
https://github.com/loopx-project/loopx.git, use origin instead of
upstream for fetch/rebase. If you prefer merging the base, use
git merge <base-remote>/main and push normally.

Keep the DCO Signed-off-by trailer on every commit when you rebase.
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase Mergify: the pull request has merge conflicts with its base branch label Nov 20, 2026
@loopx-agent

Copy link
Copy Markdown
Collaborator Author

Superseded by #9176, which makes Complete Turn the default for bound calls, removes the live legacy writer and format selectors, and carries forward the measured payload budget. See #9176 for the packaged runtime and historical receipt acceptance evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase Mergify: the pull request has merge conflicts with its base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant